package com.example.week1.mvp.model;

import android.util.Log;

import com.example.mylibrary.mvp.model.BaseModel;
import com.example.mylibrary.okhttp.MyCallBack;
import com.example.week1.mvp.contrat.RegisterContrat;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import java.util.HashMap;

public  class RegisterModel extends BaseModel implements RegisterContrat.RegisterModel{
    @Override
    public void register(String username, String pwd, String repwd, MyCallBack myCallBack) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("username",username);
        hashMap.put("password",pwd);
        hashMap.put("repassword",repwd);
        OkGo.<String>post("https://www.wanandroid.com/user/register")
                .params(hashMap)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        String body = response.body();
                        Log.i("TAG", "onSuccess:----------> "+body);
                    }
                });
    }
}
